local function getupvaluetable(func, inname)
    local i = 1
    while true do
        local name, value = debug.getupvalue(func, i)
        if name == nil then
            return
        end
        
        if name == inname then
            return i,value
        end
        
        i=i+1
    end
end

if not _P then
    print "inject error!"
    return
end

local lua = _P.lua
local _, fmatch_util = getupvaluetable(lua.CMD.get_created_club_friend_tables,'fmatch_util')
local _, get_zjh_created_club_friend_tables = getupvaluetable(fmatch_util.get_created_club_friend_tables,'get_zjh_created_club_friend_tables')
local _, get_zjh_created_friend_tables = getupvaluetable(fmatch_util.get_created_friend_tables,'get_zjh_created_friend_tables')
local _, table_def = getupvaluetable(fmatch_util.get_created_club_friend_tables,'table_def')

fmatch_util.get_created_club_friend_tables = function(self,table_info,table_info_list)
	local rsp_table = {}
	--通用字段
	rsp_table.password = table_info.password
	rsp_table.table_type = table_info.table_type
	rsp_table.cost_type = table_info.cost_type
	rsp_table.max_player_num = table_info.play_num
	rsp_table.is_aa = table_info.is_aa
	rsp_table.created_time = table_info.created_time
	rsp_table.dizhu = table_info.dizhu
	rsp_table.count = table_info.count
	rsp_table.cost = table_info.cost
	rsp_table.is_authorized_seat = table_info.is_authorized_seat
	rsp_table.min_need_money = table_info.min_need_money
	rsp_table.max_need_money = table_info.max_need_money
	rsp_table.game_time = table_info.game_time
	rsp_table.create_name = table_info.create_name
	rsp_table.table_name = table_info.table_name
	rsp_table.creator_uid = table_info.creator_uid

	local password = table_info.password
	if table_info_list and table_info_list[password] then
		rsp_table.left_round = table_info_list[password].left_round
		rsp_table.cur_player_num = table_info_list[password].cur_player_num or 0
		if table_info_list[password].curr_round and table_info_list[password].curr_round > 0 then
			rsp_table.is_running = true
		end
	else
		rsp_table.left_round = table_info.count
	end

	if table_def.zhajinghua_ftable_map[table_info.table_type] then
		get_zjh_created_club_friend_tables(table_info,rsp_table)
	end

	return rsp_table
end

fmatch_util.get_created_friend_tables = function(self,table_info,table_info_list)
	local rsp_table = {}
	rsp_table.table_type = table_info.table_type
	rsp_table.is_aa = table_info.is_aa
	rsp_table.password = table_info.password
	rsp_table.created_time = table_info.created_time
	rsp_table.dizhu = table_info.dizhu
	rsp_table.count = table_info.count
	rsp_table.max_player_num = table_info.play_num

	local password = table_info.password
	if table_info_list and table_info_list[password] then
		rsp_table.left_round = table_info_list[password].left_round
		rsp_table.cur_player_num = table_info_list[password].cur_player_num or 0
	else
		rsp_table.left_round = table_info.count
	end

	if table_def.zhajinghua_ftable_map[table_info.table_type] then
		get_zjh_created_friend_tables(table_info,rsp_table)
	end

	return rsp_table
end